package cn.com.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.com.biz.GuanLiYuanBiz;

import com.opensymphony.xwork2.ActionSupport;

public class GuanLiYuanLogin extends ActionSupport implements SessionAware{
	Map<String, Object> session;
	
	public Map<String, Object> getSession() {
		return session;
	}
	@Override
	public void setSession(Map<String, Object> arg0) {
		session=arg0;
		
	}
	private GuanLiYuanBiz glyBiz;
	private	String uname;
	private String upwd;
	
	public GuanLiYuanBiz getGlyBiz() {
		return glyBiz;
	}
	public void setGlyBiz(GuanLiYuanBiz glyBiz) {
		this.glyBiz = glyBiz;
	}
	public String getUname() {
		return uname;
	}
	public void setUname(String uname) {
		this.uname = uname;
	}
	public String getUpwd() {
		return upwd;
	}
	public void setUpwd(String upwd) {
		this.upwd = upwd;
	}
	public String guanLiLogin(){
		ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
		glyBiz=(GuanLiYuanBiz)ctx.getBean("glyBiz");
		boolean b=glyBiz.guanLiLogin(uname, upwd);
		if(b){
			session.put("uname", uname);
			return SUCCESS;
		}else{
			return ERROR;
		}
	}
}
